<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script src="./lib/jquery.js"></script>
</head>

<body>
  <input type="text">

  <script>
    $(function () {
      let a = 2;
      // ①输入框渲染a变量的值
      $('input').val(a);
      // ②用户在修改输入框内容时候, a变量的值保存用户修改的内容
      $('input').keyup(function () {
        a = $(this).val();
        console.log(a);
      })
    })
  </script>
</body>

</html>